package red.mlz.consoleconsumer.feign.user;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import red.mlz.common.entity.user.User;

import java.math.BigInteger;

@FeignClient(name = "user-service")
public interface UserFeign {
    @RequestMapping("/user-service/getById")
    User getById(@RequestParam(name = "id") BigInteger id);

    @RequestMapping("/user-service/loginB")
    Boolean loginB(@RequestParam(name = "phone") String phone,
                         @RequestParam(name = "password") String password,
                         @RequestParam(name = "remember" , required = false) Boolean remember);

    @RequestMapping("/user-service/loginA")
    Boolean loginA(@RequestParam(name = "phone") String phone,
                         @RequestParam(name = "countryCode") String countryCode,
                         @RequestParam(name = "password") String password,
                         @RequestParam(name = "noPasswd") boolean noPasswd,
                         @RequestParam(name = "remember" , required = false) Boolean remember,
                         @RequestParam(name = "lifeTime") int lifeTime);

    @RequestMapping("/user-service/getByPhone")
    User getByPhone(@RequestParam String phone);

    //刷新用户登录上下文
    @RequestMapping("/user-service/refresh")
    void refreshUserLoginContext(@RequestParam(name = "id") BigInteger id,
                                        @RequestParam(name = "ip") String ip,
                                        @RequestParam(name = "time") int time);
}
